<!--<?php
include_once PrintEot('header');
if(empty($action)){
print <<<EOT
-->
<form action="$admin_file" method="post" name="form">

    <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td align="left" class="tittab">
                <strong>站长管理 &gt;&gt;  站长申请投放初审</strong>
            </td>
        </tr>
    </table>
    <table id="Table50" border="0" cellpadding="0" cellspacing="1" width="98%" align=center>
         <tr>
         	<td>&nbsp;&nbsp;<b>快速查询：</b>
			<select id="searchtype" name="searchtype">
<!--
EOT;
				if(empty($searchtype) || $searchtype=="aff_id")  echo '<option value="aff_id" selected>站长ID</option>';
			    else echo '<option value="name">站长ID</option>';
				if(!empty($searchtype) && $searchtype=="aff_name")  echo '<option value="aff_name" selected>站长名称</option>';
			    else echo '<option value="name">站长名称</option>';
				if(!empty($searchtype) && $searchtype=="site_name")  echo '<option value="place_url" selected>站点名称</option>';
			    else echo '<option value="place_url">站点名称</option>'; 			    
				if(!empty($searchtype) && $searchtype=="adv_name")  echo '<option value="adv_name" selected>广告计划</option>';
			    else echo '<option value="adv_name">广告计划</option>';
print <<<EOT
-->				
				</select>
							<input type="text" name="searchkey" Width="60" style="font-size:12px;" class="text" value="$searchkey"/>
						开始时间：<input name="start_date" type="text"  class="text" readonly value="$start_date"/><A href="javascript:OpenCalendar('start_date', false)"><IMG src="$imgpath/admin/icon-calendar.gif" align="absMiddle" border="0"></A>
						结束时间：<input name="end_date" type="text" class="text" readonly value="$end_date"/><A href="javascript:OpenCalendar('end_date', false)"><IMG src="$imgpath/admin/icon-calendar.gif" align="absMiddle" border="0"></A>
						<input type="submit" value="查询" class="text"/>
            </td>
            <td align="right" valign="center">
                <table id="Table51" border="0" cellpadding="0" cellspacing="5" height="30">
                    <input id="Hidden1" name="allSelect" type="hidden" value="all" />
                    <tr>
                        <td align="middle" valign="center">
                            <a href="javascript:document.location.reload();">
<img align="absMiddle" border="0" height="15" src="$imgpath/admin/reserch.gif" style="text-decoration: underline" width="17" />
<span style="color: #547054"> 刷新</span></a>
<!--
EOT;
	if($canaudit==true){
		showButton(4,'审核','javascript:showAudit("'.$admin_file.'&action=audit&status=1'.$transtr.'&curpage='.$curpage.'");');
	}
	if($canadd==true){
		showButton(1,'新增',$admin_file.'&action=new'.$transtr);
	}
	if($candel==true){
		showButton(2,'删除','javascript:ConfirmDel("'.$admin_file.'&action=del'.$transtr.'&curpage='.$curpage.'","此操作不可恢复,确认删除吗？");');
	}
print <<<EOT
-->
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td height="2">
            </td>
        </tr>
    </table>
    <div class="tab">
        <table id="Table52" border="0" cellpadding="3" cellspacing="0" align=center>
            <tr>
                <td align="middle" class="title" height="20" valign="center"> 序号</td>
                <td align="middle" class="title" height="20" valign="center">
                    <input id="Checkbox1" name="as" onclick="allchecked()" type="checkbox" />全选
                </td>
                <td align="middle" class="title" height="20" valign="center">站长</td>
                <td align="middle" class="title" height="20" valign="center">允许站点</td>
                <td align="middle" class="title" height="20" valign="center">申请广告</td>        
                <td align="middle" class="title" height="20" valign="center">创建时间</td>
                <td align="middle" class="title" height="20" valign="center">状态</td>
                <td align="middle" class="title" height="20" valign="center">审批记录</td>
                <td align="middle" class="title" height="20" valign="center">编辑</td>
            </tr>
<!--
EOT;
$curidx = ($curpage-1)*$perpage;
$curpageidx = 0;
$showcount = count($db_affadvapplylist); 
foreach($db_affadvapplylist as $db_advapply ){
	$curidx = $curidx+1;
	$curpageidx = $curpageidx+1;
	if($db_advapply[create_time]>0) $cdate = date('Y/m/d H:i:s',$db_advapply[create_time]);
	$applystatus = $cfg_affapplystatus[$db_advapply[status]];
	$showsite = "";
	if(strpos($db_advapply[site_ids],',')>0){
		$arrsiteids = explode(",",$db_advapply[site_ids]);
		$objAffiliate = LOAD::loadDB("Affiliate");
		foreach($arrsiteids as $siteid){
			if(strlen($siteid)>0){
				$db_site = $objAffiliate->getAffWebSite($siteid);
				if($db_site){
					$showsite .='<a href="'.$basename.'?job=detail&action=affsite&curid='.$db_site[id].$transtr.'&backurl='.$backurl.'" class="noline">'.$db_site[name].'</a>,';
				}
			}
		}
		$showsite = substr($showsite,0,strlen($showsite)-1);
	}
print <<<EOT
-->    
            <tr height="30" onclick="SwitchTd(this,'click',$curpageidx);" onmouseout="SwitchTd(this,'out',$curpageidx);" onmouseover="SwitchTd(this,'over',$curpageidx);" style="cursor: hand">
                <td align="middle" valign="center">$curidx</td>
                <td align="middle" class="hei" valign="center"><input id="ids" name="ids" type="checkbox" value="$db_advapply[id]" /></td>
                <td valign="middle" align="center">&nbsp;
                <a href='$basename?job=detail&action=affiliate&curid=$db_advapply[aff_id]$transtr&backurl=$backurl' class="noline">$db_advapply[aff_name]($db_advapply[aff_id])</a>
                </td>
                <td valign="middle" align="center">&nbsp;$showsite</td>
                <td valign="middle" align="center">&nbsp;<a href="$basename?job=detail&action=advertise&curid=$db_advapply[adv_id]$transtr&backurl=$backurl" class="NoLine">$db_advapply[adv_name]($db_advapply[adv_id])</td>
                <td valign="middle" align="center">&nbsp;$cdate</td>
                <td valign="middle" align="center">&nbsp;$applystatus</td>
                <td valign="middle" align="center">&nbsp;<a href="$basename?job=detail&action=advapply&curid=$db_advapply[id]$transtr&backurl=$backurl">[查看详情]</a></td>
                <td valign="middle" align="center">&nbsp;
<!--
EOT;
	showEditButton($db_advapply[id]);
print <<<EOT
-->
                </td>
            </tr>
<!--
EOT;
}print <<<EOT
--> 
        </table>
    </div>
    <table id="Table1" border="0" cellpadding="0" cellspacing="0" width="98%">
        <tr>
            <td>
                &nbsp;</td>
            <td align="right" height="35">
<!--
EOT;
	showPageBreakInfo($showcount);
print <<<EOT
--> 
             &nbsp;</td>
        </tr>
    </table>
    <input type="hidden" id="count" name="count" value="$showcount" />

</form>

<!--
EOT;
}else if($action=="new" || $action=="edit"){
$disabled = "";
if($action=="edit") $disabled = "disabled";
print <<<EOT
--> 
<form action="$admin_file" method="post" name="form" onsubmit="return checkfrm();">
<input type="hidden" name="action" value="save"/>
<input type="hidden" name="curid" id="curid" value="$curid"/>
<input type="hidden" name="status" id="status" value="$status"/>
<input type="hidden" name="searchtype" id="searchtype" value="$searchtype"/>
<input type="hidden" name="searchkey" id="searchkey" value="$searchkey"/>
<input type="hidden" name="site_ids" id="site_ids" value="$db_advapply[site_ids]"/>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border=0 ID="Table22">
	<TBODY>
		<TR >
			<TD class="tittab" BACKGROUND="$imgpath/admin/menu_bg.gif"><strong><img src="$imgpath/admin/view.gif" width="15" height="13" align="absmiddle"> 新增/编辑　站长广告申请</strong></TD>
		</TR>
	</TBODY>
</TABLE>
<table cellspacing=0 cellpadding=0 width="100%" border=0 id="Table23">  
    <tbody>
      <tr>
        <td valign=top>
		<div class="addpro">
		<table cellspacing=0 cellpadding=4 width="100%" border=0 align=center id="Table24">
        <tbody>
                <tr>
					<td align=right>申请站长(<font color="red">*</font>)：</td>
					<td><input type="text" id="aff_name" name="aff_name" style="WIDTH: 261px" value="$db_advapply[aff_name]" class="text" $disabled/>
<!--
EOT;
if(strlen($disabled)==0){
print <<<EOT
-->					
					<a href="#" onclick="javascript:showAffHasSitelist()"><IMG style="CURSOR: hand" $disabled height="21" src="$imgpath/admin/image_fdj.gif" width="24" align="absMiddle" border="0"/>请选择站长</a>
<!--
EOT;
}
print <<<EOT
-->	
					    <input type=hidden name="aff_id" id="aff_id" value="$db_advapply[aff_id]"/>
					</td>
				</tr>			
				<tr>
					<td align=right>申请广告(<font color="red">*</font>)：</td>
					<td>
					<select ID="adv_id" name="adv_id" style="WIDTH: 261px" >
					$op_advlist
					</select></td>
				</tr>
				<tr>
					<td align=right>允许站点(<font color="red">*</font>)：</td>
					<td><div id=divSite>
<!--
EOT;
if(isset($db_sitelist)){
	foreach($db_sitelist as $db_site){
		$pos = strpos(",,".$db_advapply[site_ids],",".$db_site[id].',');
		if($pos)
			echo "<input type='checkbox' name='site_id' id='site_id' value='".$db_site[id]."' checked/>".$db_site[name]." ";
		else
			echo "<input type='checkbox' name='site_id' id='site_id' value='".$db_site[id]."'/>".$db_site[name]." ";		
	}
}else{
	echo "&nbsp;";
}
print <<<EOT
--></div>
					</td>
				</tr>				
				<tr>				
					<td align=right>申请说明：</td>
					<td><textarea name="memo" id="memo" style="WIDTH: 261px;height:60px">$db_advapply[memo]</textarea></td>
				</tr>				
				<tr>
					<td align=right>&nbsp;</td>
					<td align="left" height="40px">
					<input type="submit" id="btnSubmit" value=" 确定 " class="text" NAME="btnSubmit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
					<input type="button" onclick="history.go(-1);" value=" 取消 " class="text" >
					</td>
				</tr>
         
    </tbody>
 </table>
 </div></TD>
  </TR>
 </TBODY>

 </TABLE>
 </form>

<script>
	function checkfrm(){
		if(isEmpty($('aff_id').value)){
			alert('请选择站长！');
			$('aff_name').focus();
			return false;
		}
		$("site_ids").value = "";
		$$('input[type="checkbox"][name="site_id"]').each(function(node){
			if(node.checked)  $("site_ids").value+=node.value+",";
		});	
		if(isEmpty($("site_ids").value)){ alert("请选择站点");return false;}	
		return true;
	}
</script>

<!--
EOT;
}
if($action=="audit"){print <<<EOT
-->
<form action="$admin_file" method="post" name="form" onsubmit="javascript:return checkfrm();">
<input type="hidden" name="action" value="auditsave"/>
<input type="hidden" name="ids" value="$ids"/>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border=0 ID="Table22">
	<TBODY>	    
		<TR >
			<TD class="tittab" BACKGROUND="$imgpath/admin/menu_bg.gif">
			<strong><img src="$imgpath/admin/view.gif" width="15" height="13" align="absmiddle"> 审批站长</strong></TD>
		</TR>
	</TBODY>
</TABLE>
<table cellspacing=0 cellpadding=0 width="98%" border=0 id="Table23">  
    <tbody>
      <tr>
        <td valign=top>
		<div class="addpro">
		<table cellspacing=0 cellpadding=4 width="98%" border=0 align=center id="Table24">
            <tbody>
                <tr>
					<td align="right" width="15%">审批结果<font color=red>*</font>：</td>
					<td>
				 		<input type="radio" name="auditstatus" id='auditstatus1' value="1" checked onclick='javascript:$("content").value="该站长可投放此广告！";'/><label for="auditstatus1">通过审核</label> 
				 		<input type="radio" name="auditstatus" id='auditstatus2' value="2" onclick='javascript:$("content").value="该站长不可投放此广告！";'/><label for="auditstatus2">审核不通过</label>
				 		<input type="radio" name="auditstatus" id='auditstatus3' value="4" onclick='javascript:$("content").value="网站或站点信息有误，请修正后重新申请！";'/><label for="auditstatus3">驳回申请</label>
					</td>
				</tr>
				<tr>
					<td align=right>审核内容：</td>
					<td><textarea name="content" id="content" style="width: 90%; height:55px">内容信息完整，站长情况属实，允许通过！</textarea></td>
				</tr>
				<tr>
					<td colspan="2" align="center">
					<input type="submit"  value=" 确定 " NAME="btnSubmit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
					<input type="button" onclick="window.close();" value=" 取消"/>
					</td>
				</tr>
         
    </tbody>
 </table>
 </div></TD>
  </TR>
 </TBODY>

 </TABLE>
 </form>
<script>
function checkfrm(){
	if(isEmpty($('content').value)){
		alert("请输入审批内容!");
	}
}
</script>

<!--
EOT;
}?>-->